<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Shopping list</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }

    body {
      color: white;
      background-color: #000;
    }
    p {
      color: yellow;
      font-family: "arial", sans-serif, serif;
      font-size: 1.2em;
    }
  </style>
</head>
<body>
  <h1 id="jsH1">want to buy</h1>
  <p title="a gentle reminder">Don't forget to buy this stuff.</p>
  <ul id="purchases">
    <li>A tin of beans</li>
    <li class="sale">Cheese</li>
    <li class="sale important">Milk</li>
  </ul>

  <script>
    const jsH1 = document.getElementById('jsH1')
    jsH1.setAttribute('title', '哈哈哈')
    console.log(jsH1, jsH1.getAttribute('id'))
    const liList = document.getElementsByTagName('li')
    console.log(liList)
    const sales = document.getElementsByClassName('sale')
    console.log(sales)

    // childNodes
    console.log(document.getElementById('purchases').childNodes)
    console.log(jsH1.nodeValue, jsH1.firstChild.nodeValue)
  </script>


  <button onclick="showPopup()">点击弹出</button>
  <script>
    function showPopup() {
      window.open('http://www.baidu.com', 'CNN_WindowName', 'width=300,height=200,left=100,top=200')
    }
  </script>
</body>
</html>